package com.lsp.microorder.goods.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lsp.microcommon.common.PageParam;
import com.lsp.microcommon.common.PageVo;
import com.lsp.microcommon.entity.OrderData;
import com.lsp.microorder.goods.dao.GoodsOrderDao;
import com.lsp.microorder.goods.service.GoodsOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class GoodsOrderServiceImpl implements GoodsOrderService {

    @Resource
    private GoodsOrderDao goodsOrderDao;

    @Override
    public PageVo<OrderData> pageOrder(PageParam param) {

        Page<OrderData> page = new Page<>(param.getPageNum(), param.getPageSize());
        Page<OrderData> orderPage = goodsOrderDao.selectPage(page, new LambdaQueryWrapper<OrderData>());

        PageVo<OrderData> pageVo = new PageVo<>();
        pageVo.setDataList(orderPage.getRecords());
        pageVo.setTotal(orderPage.getTotal());
        return pageVo;
    }
}
